package com.jiashihui.server1.exception;

/**
 * describe: 自定义异常基类
 *
 * @author jiashihui
 * @date 2018/11/20
 */
public class BaseException extends Exception{
    private static final long serialVersionUID = 9161453914988351031L;

    /**
     * 错误码
     */
    private int code;

    /**
     * 构造异常
     *
     * @param code 异常状态码
     * @param msg  异常讯息
     */
    public BaseException(int code, String msg) {
        super(msg);
        this.code = code;
    }

    /**
     * 构造异常
     *
     * @param code 异常状态码
     * @param ex   异常来源
     */
    public BaseException(int code, Exception ex) {
        super(ex);
        this.code = code;
    }

    /**
     * @return 异常状态码。
     */
    public int getErrorCode() {
        return code;
    }

}
